package click
import grails.plugins.springsecurity.Secured


@Secured(['ROLE_ADMIN'])
class IndexController {

    def index = {
         redirect(action: "list", controller: "ip")
    }

    def a = {
//        response.setContentType("text/html;charset=UTF-8")
//        response.setHeader("Pragma", "No-cache"); 
//        response.setHeader("Cache-Control", "No-cache"); 
        println request.getHeader("referer")
        def hs = request.getHeaderNames()
        def string = new StringBuffer()
        hs.each{ 
            string.append it + "="+  request.getHeader(it) +"<br>"
        } 
        string.append " <a href='b' id='bbb'>BBB</a>" 
        string.append " <img src='/index/b'>" 
        println "===========AAA {new Date()}============="
        render(string)
    }

    def b = {
    println request.getHeader("referer")
        def hs = request.getHeaderNames()
        def string = new StringBuffer()
        hs.each{ 
            string.append it + "="+  request.getHeader(it) +"<br>"
        } 
        string.append " <a href='a'>AAA</a>" 
        println "===========BBB {new Date()}============="
        render(string)
    }

    def test = {
        
        return [machineInstanceList:  0..10]
    }

    def update = {
        if (params.version) {
            ApiController.version = params.version
        }
        if (params.updateURL) {
            ApiController.updateURL = params.updateURL
        }
        return [ version:  ApiController.version, updateURL : ApiController.updateURL]
    }
}
